package com.csg.boot.starter.builder;

import com.csg.boot.starter.constant.SwaggerProperties;
import springfox.documentation.swagger.web.UiConfiguration;

/**
 * @author george
 */
public class UiConfigurationBuilder implements BaseBuilder<UiConfiguration, SwaggerProperties.UiConfigProperties> {

    private static UiConfigurationBuilder builder = new UiConfigurationBuilder();

    private UiConfigurationBuilder() {
    }

    public static UiConfigurationBuilder getInstance() {
        return builder;
    }

    @Override
    public UiConfiguration build(SwaggerProperties.UiConfigProperties properties) {
        return springfox.documentation.swagger.web.UiConfigurationBuilder.builder()
                .deepLinking(properties.getDeepLinking())
                .defaultModelExpandDepth(properties.getDefaultModelExpandDepth())
                .defaultModelRendering(properties.getDefaultModelRendering())
                .defaultModelsExpandDepth(properties.getDefaultModelsExpandDepth())
                .displayOperationId(properties.getDisplayOperationId())
                .displayRequestDuration(properties.getDisplayRequestDuration())
                .docExpansion(properties.getDocExpansion())
                .maxDisplayedTags(properties.getMaxDisplayedTags())
                .operationsSorter(properties.getOperationsSorter())
                .showExtensions(properties.getShowExtensions())
                .tagsSorter(properties.getTagsSorter())
                .validatorUrl(properties.getValidatorUrl())
                .build();
    }
}
